/*
 * @Author: 张强
 * @Date: 2020-03-10 08:59:17
 * @LastEditTime: 2020-03-10 12:58:00
 * @LastEditors: Please set LastEditors
 * @Description: 全局混入
 * @FilePath: \artwork\src\mixins\route.js
 */
export const mixinRoute = {
    beforeRouteLeave(to, from, next) {
        // let flag = true;
        // this.$store.state.options.forEach(e => {
        //     // options存储打开的tabs的组件路由
        //     if (from.path == e.route) {
        //         flag = false;
        //     }
        // });
        // if (flag && this.$vnode.parent && this.$vnode.parent.componentInstance.cache) {
        //     let key = this.$vnode.key; // 当前关闭的组件名
        //     let cache = this.$vnode.parent.componentInstance.cache; // 缓存的组件
        //     let keys = this.$vnode.parent.componentInstance.keys; // 缓存的组件名
        //     if (cache[key] != null) {
        //         delete cache[key];
        //         let index = keys.indexOf(key);
        //         if (index > -1) {
        //             keys.splice(index, 1);
        //         }
        //     }
        // }
        console.log("beforeRouteLeave -> this.$vnode.parent", this.$vnode.parent);
        next();
    },
};
